import type { PageParam, PageResult } from '@vben/request';
import type { Dayjs } from 'dayjs';

import { requestClient } from '#/api/request';

export namespace BxcCameraGroupApi {
  /** 摄像头分组信息 */
  export interface BxcCameraGroup {
    id: number; // 编号
    name?: string; // 分组名字
    parentId?: number; // 父分组编号
    subsidiary: string; // 分公司
    description: string; // 描述
  }
}

/** 查询摄像头树状图 */
export function getTree() {
  return requestClient.get<PageResult<BxcCameraGroupApi.BxcCameraGroup>>('/moxi/bxc-camera-group/tree');
}
/** 查询摄像头分组分页 */
export function getBxcCameraGroupPage(params: PageParam) {
  return requestClient.get<PageResult<BxcCameraGroupApi.BxcCameraGroup>>('/moxi/bxc-camera-group/page', { params });
}

/** 查询摄像头分组详情 */
export function getBxcCameraGroup(id: number) {
  return requestClient.get<BxcCameraGroupApi.BxcCameraGroup>(`/moxi/bxc-camera-group/get?id=${id}`);
}

/** 新增摄像头分组 */
export function createBxcCameraGroup(data: BxcCameraGroupApi.BxcCameraGroup) {
  return requestClient.post('/moxi/bxc-camera-group/create', data);
}

/** 修改摄像头分组 */
export function updateBxcCameraGroup(data: BxcCameraGroupApi.BxcCameraGroup) {
  return requestClient.put('/moxi/bxc-camera-group/update', data);
}

/** 删除摄像头分组 */
export function deleteBxcCameraGroup(id: number) {
  return requestClient.delete(`/moxi/bxc-camera-group/delete?id=${id}`);
}

/** 批量删除摄像头分组 */
export function deleteBxcCameraGroupList(ids: number[]) {
  return requestClient.delete(`/moxi/bxc-camera-group/delete-list?ids=${ids.join(',')}`)
}

/** 导出摄像头分组 */
export function exportBxcCameraGroup(params: any) {
  return requestClient.download('/moxi/bxc-camera-group/export-excel', params);
}

/**统计摄像头数量 */ 
export function getStat(params: PageParam) {
  return requestClient.get<any>('/moxi/bxc-camera-info/stat', { params });
}

// 获得当前分组摄像头数量统计
export function getbByByGroup(params: PageParam) {
    return requestClient.get<any>(`/moxi/bxc-camera-info/statByGroup`,{ params });
}

//同步摄像头信息
export function getSyncState() {
    return requestClient.get<any>(`/moxi/bxc-camera-info/getSyncState`);
} 
// 获取分组下的多有摄像头
export function getAllCamera(params: PageParam) {
    return requestClient.get<any>(`/moxi/bxc-camera-info/page`,{ params });
}   